<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <title></title>
</head>
<body>
    <input id="name" type="text">
    <input type="button" value="点击执行ajax请求" onclick="doajax();" />



    <script src="/static/jquery/jquery-3.0.0.js"></script>
    <script type="text/javascript">
        function doajax(){
            var temp = $('#name').val()
            $.ajax({
                url:'/app02/ajax/',
                type:'POST',
                data:{data:temp},
                sucess:function(arg){
                    var obj = jQuery.paresJSON(arg);    <!--将字符串变成js识别的字典-->
                    <!--返回views.py的返回值-->
                    console.log('obj.status');
                    console.log('obj.msg');
                    console.log('obj.data');
                    console.log('sucess');
                    $('#name').val(obj.msg)
                },
                error:function(){
                    console.log('failed')
                }
            });
    }

    </script>

</body>
</html>